<?php
e($javascript->link('jquery'));
$this->pageTitle = 'Free Logo'.$brand;
?>

<script>
    $(document).ready(function(){
        $('.next-slide-image a').click(function(){
            var id = $(this).attr('id');

            if(id == 1){ $('.prev-slide-image').fadeIn(); }
            if(id == 4){ $('.next-slide-image').attr('id','passive');}
            if(id<5){
                $('.content-new-box').hide();
                id++;
                $('#new-box-'+id).fadeIn('slow');
                $('.next-slide-image a').attr('id',id);
                $('.prev-slide-image a').attr('id',id);
            }

            return false;
        });

        $('.prev-slide-image a').click(function(){
            var id = $(this).attr('id');
            if(id == 2){ $('.prev-slide-image').hide(); }
            if(id == 5){ $('.next-slide-image').attr('id','active'); }

            $('.content-new-box').hide();
            id--;
            $('#new-box-'+id).fadeIn('slow');
            $('.next-slide-image a').attr('id',id);
            $('.prev-slide-image a').attr('id',id);

            return false;
        });

        $('#ContactAddForm').submit(function(){
            var description = $('#ContactDescription').val();

            if(description.length<1){
                $('#contactError').empty().append('Form still empty.')
            }else{
                $('#ContactAddForm').hide('fast',function(){
                    $('#emailForm').fadeIn();
                });
            }
            
            return false;
        });

        $('#EmailAddForm').submit(function(){
            $('#contactError').empty();
            var input_name = $('#EmailName').val();
            var input_email = $('#EmailEmail').val();
            var input_website = $('#EmailWebsite').val();
           var input_description = $('#ContactDescription').val();
            var input_user = '<?=$_SERVER["REMOTE_ADDR"]?>';
            
            if(input_description.length<1){$('#contactError').append('Failed. Please refresh your browser.<br />');}
            if(input_name.length<1){$('#contactError').append('Your name still empty<br />.');}
            if(input_email.length<1){$('#contactError').append('Your email still empty<br />.');}
            if(input_user.length<1){$('#contactError').append('Failed. Please refresh your browser.<br />');}
            if(input_description.length>0 || input_email.length>0 || input_name.length>0 || input_user.length>0){
               $.ajax({
                    type: "POST",
                    data: ({name: input_name,email:input_email,description:input_description,website:input_website,user:input_user}),
                    dataType: "json",
                    url: "<?=$baseUrl?>/contacts/add",

                    success: function(data){
                        $('#contactError').empty();
                        if(data.result){
                            $('#emailForm').fadeOut('slow',function(){
                                $('#ContactAddForm').empty();
                                $('#emailForm').empty();
                            });
                            $('#contactError').append('Thanks for your contacting.<br /> We will processed it..');
                        }else if(data.error){
                            if(data.error == '0'){
                                $('#contactError').append('Some form still empty.');
                            }else if(data.error == '1'){
                                $('#contactError').append('You have same contact before.<br />');
                            }else if(data.error == '2'){
                                $('#contactError').append('Failed saving. Please try again.<br />');
                            }else if (data.error.email == '1'){
                                $('#contactError').append('Your email is not valid.');
                            }else{
                                $('#contactError').append('Failed. Please refresh your browser.<br />');
                            }
                        }else{
                            $('#contactError').append('Please check your connection<br />');
                        }
                    },
                    error:function(XMLHttpRequest,textStatus, errorThrown)
                    {
                        var status = XMLHttpRequest.status;
                        if(status == '403'){
                           $('#contactError').empty().append('Please check your connection<br />');
                        }
                    }
                });
            }else{
                $('#contactError').append('Failed. Please refresh your browser.<br />');
            }
            
            return false;
        });

    });
</script>

<div id="content-main">
    <div id="content-new">
        <div id="content-new-title"><h1>Top #5 hot logo fresh from oven</h1></div>
        <div id="content-new-content">
            <?php if(isset($postNews)) :?>
            <?php $i = 0; ?>
            <?php foreach($postNews as $postNew) :?>
                <?php if($i++== 0):?>
                   <div class="content-new-box" id="new-box-<?=$i?>" >
                        <div id="content-new-image">
                                <?=$html->image('thumbs//'.$postNew['Path']['name'].$postNew['Post']['image'].'.jpg',array('url'=>$baseUrl.'/view/'.$postNew['Post']['slug'],'alt'=>$postNew['Post']['title']));?>
                        </div>
                        <div id="content-new-description">
                                <h1><?=$html->link('#'.$i.' '.ucfirst($postNew['Post']['title']),$baseUrl.'/view/'.$postNew['Post']['slug'],array('title'=>$postNew['Post']['title'].' Free Logo'))?></h1>
                                <?=$postNew['Post']['description']?>
                                <div class="content-download"><?=$html->link('View logo',$baseUrl.'/view/'.$postNew['Post']['slug'],array('title'=>'Free Logo'))?></div>
                        </div>
                        <div class="clear"></div>
                    </div>
                <?php else:?>
                   <div class="content-new-box" id="new-box-<?=$i?>" style="display:none;">
                        <div id="content-new-image">
                                <?=$html->image('thumbs/'.$postNew['Path']['name'].$postNew['Post']['image'].'.jpg',array('url'=>$baseUrl.'/view/'.$postNew['Post']['slug'],'alt'=>$postNew['Post']['title']));?>
                        </div>
                        <div id="content-new-description">
                                <h1><?=$html->link('#'.$i.' '.ucfirst($postNew['Post']['title']),$baseUrl.'/view/'.$postNew['Post']['slug'],array('title'=>$postNew['Post']['title'].' Free Logo'))?></h1>
                                <?=$postNew['Post']['description']?>
                                <div class="content-download"><?=$html->link('View logo',$baseUrl.'/view/'.$postNew['Post']['slug'],array('title'=>'Free Logo'))?></div>
                        </div>
                        <div class="clear"></div>
                    </div>
                <?php endif;?>
            <?php endforeach;?>
            <div class="clear"></div>
            <?php endif;?>

        </div>
        <div id="content-new-next">
            <strong><span class="prev-slide-image" style="display:none;"><?=$html->link('Prev','#',array('id'=>'1','title'=>'Previous new free logo'))?></span></strong>
            <strong><span class="next-slide-image" id="active"><?=$html->link('Next','#',array('id'=>'1','title'=>'Next new free logo'))?></span></strong>
        </div>
    </div>

    <div id="content-popular">
        <div class="content-popular-title"><h1>Top #5 most popular logo </h1></div>
        <div id="content-popular-content">
            <?php if(isset($postPopulars)) :?>
                <?php foreach($postPopulars as $postPopular) :?>
                    <div class="content-double-wrap">
                        <div class="content-double-box">
                            <div class="content-double-image">
                                <?=$html->image('thumbs/'.$postPopular['Path']['name'].$postPopular['Post']['image'].'_thumb.jpg',array('url'=>$baseUrl.'/view/'.$postPopular['Post']['slug'],'alt'=>$postPopular['Post']['title']));?>
                            </div>
                            <div class="content-double-description">
                                <h1><?=$html->link(ucfirst($postPopular['Post']['title']),$baseUrl.'/view/'.$postPopular['Post']['slug'],array('title'=>$postPopular['Post']['title'].' Free Logo'))?></h1>
                                <strong>Category : </strong><?=$postPopular['Category']['name']?><br />
                                <strong>Tag : </strong>
                                <?php foreach($postPopular['Tag'] as $tag) :?>
                                    <?=$tag['name'].' '?>
                                <?php endforeach;?>
                                <div class="double-download"><?=$html->link('View logo',$baseUrl.'/view/'.$postPopular['Post']['slug'],array('title'=>'Free Logo'))?></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                <?php endforeach;?>
            <?php endif;?>
        </div>
    </div>

    <div id="content-rate">
        <div class="content-popular-title"><h1>Top #5 most rated logo</h1></div>
        <div id="content-rate-content">
            <?php if(isset($postRates)) :?>
                <?php foreach($postRates as $postRate) :?>
                    <div class="content-double-wrap">
                        <div class="content-double-box">
                            <div class="content-double-image">
                                <?=$html->image('thumbs/'.$postRate['Path']['name'].$postRate['Post']['image'].'_thumb.jpg',array('url'=>$baseUrl.'/view/'.$postRate['Post']['slug'],'alt'=>$postRate['Post']['title']));?>
                            </div>
                            <div class="content-double-description">
                                <h1><?=$html->link(ucfirst($postRate['Post']['title']),$baseUrl.'/view/'.$postRate['Post']['slug'],array('title'=>$postRate['Post']['title'].' Free Logo'))?></h1>
                                <strong>Category : </strong><?=$postRate['Category']['name']?><br />
                                <strong>Tag : </strong>
                                <?php foreach($postRate['Tag'] as $tag) :?>
                                    <?=$tag['name'].' '?>
                                <?php endforeach;?>
                                <div class="double-download"><?=$html->link('View logo',$baseUrl.'/view/'.$postRate['Post']['slug'],array('title'=>'Free Logo'))?></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                <?php endforeach;?>
            <?php endif;?>
        </div>
    </div>
    <div class="clear"></div>
</div>

<div id="content-sidebar">


   <div class="content-sidebar-block">
       <div id="content-sidebar-comment-title">
           <h1>Most Commented Logo</h1>   
       </div>
        <div id="content-sidebar-comment">
            <?php if(isset($postComments)) :?>
                <?php foreach($postComments as $postComment) :?>
                    <div class="content-sidebar-wrap">
                        <div class="content-sidebar-box">
                            <div class="content-sidebar-image">
                                <?=$html->image('thumbs/'.$postComment['Path']['name'].$postComment['Post']['image'].'_thumb.jpg',array('url'=>$baseUrl.'/view/'.$postComment['Post']['slug'],'alt'=>$postComment['Post']['title']));?>
                            </div>
                            <div class="content-sidebar-description">
                                <h1><?=$html->link(ucfirst($postComment['Post']['title']),$baseUrl.'/view/'.$postComment['Post']['slug'],array('title'=>$postComment['Post']['title'].' Free Logo'))?></h1>
                                <strong><?=$postComment['Post']['comment_count']?></strong> <?=$html->image('themes/comment.png',array('alt'=>'Comment','title'=>'Comment'))?>
                                <div class="double-download"><?=$html->link('View logo',$baseUrl.'/view/'.$postComment['Post']['slug'],array('title'=>'Free Logo'))?></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                <?php endforeach;?>
            <?php endif;?>
        </div>
    </div>

   <div class="content-sidebar-block">
        <div class="content-sidebar-download">
            <div class="content-sidebar-download-title">
               <h1>Download this site source code</h1>
            </div>
            <div class="content-sidebar-download-content">
                 <?=$html->image('themes/download.png',array('url'=>$baseUrl.'/download/','alt'=>'Download FreeLogo.web.id CMS'));?>
            </div>
        </div>
    </div>

    <div class="content-sidebar-block">
        <div class="content-sidebar-download">
            <div class="content-sidebar-download-title">
               <h1>About Developer & Logo Designer</h1>
            </div>
            <div class="content-sidebar-download-content">
                 <strong><a href="<?=$baseUrl?>/about#ryan" title="Freelance Logo Developer">#1 Ryan - Logo designer</a></strong><br />
                 Freelance logo designer using Inkscape and Linux for designing logo.
                 <br/><br />
                <strong><a href="<?=$baseUrl?>/about#yodi" title="Freelance Website Developer">#2 Yodi - Web Developer</a></strong><br />
                 Freelance web developer that loves use CakePHP framework for working.

            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div class="clear"></div>

<div id="content-base">
    <div id="content-base-left">
        <div class="content-base-title"><h1>Last incoming comments</h1></div>
        <div id="content-base-left-content">
            <?php if(isset($comments)) :?>
                <?php foreach($comments as $comment) :?>
                    <div class="content-base-wrap">
                        <div class="content-base-box">
                            <div class="content-base-image">
                                <?=$html->image('thumbs/'.$comment['Post']['Path']['name'].$comment['Post']['image'].'_thumb.jpg',array('url'=>$baseUrl.'/view/'.$comment['Post']['slug'],'alt'=>$comment['Post']['title']));?>
                            </div>
                            <div class="content-base-description">
                                <h1><?=$html->link(ucfirst($comment['Post']['title']),$baseUrl.'/view/'.$comment['Post']['slug'],array('title'=>$comment['Post']['title'].' Free Logo'))?></h1>
                                <?=$html->image('themes/comment.png',array('alt'=>'Comment','title'=>'Comment'))?>
                                <?php if(!empty($comment['Comment']['website'])) : ?>
                                    <strong><?=$html->link(ucfirst($comment['Comment']['name']),'/view/'.$comment['Post']['slug'].'#comment-block-'.$comment['Comment']['comment_id'])?></strong>
                                <?php else: ?>
                                    <strong><?=ucfirst($comment['Comment']['name']);?></strong>
                                <?php endif;?>
                                <div class="content-base-description-comment">
                                    <a href="<?=$baseUrl?>/view/<?=$comment['Post']['slug']?>#comment-block-<?=$comment['Comment']['comment_id']?>" title="Show comment"><?=$comment['Comment']['description']?> [ ... ]</a>
                                </div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                <?php endforeach;?>
            <?php endif;?>
        </div>
    </div>
    <div id="content-base-middle">
        <div class="content-base-title">
            <h1>Freelogo.web.id sitemap</h1>
        </div>
         <div class="content-base-middle-desciption">
            <div class="content-base-middle-menu"><?=$html->link('Home','#',array('title'=>'Back to top'))?></div>
            <div class="content-base-middle-menu"><?=$html->link('About','/about',array('title'=>'About FreeLogo.web.id'))?></div>
            <div class="content-base-middle-menu"><?=$html->link('Contact Us','/contact',array('title'=>'Contact logo designer and website developer'))?></div>
            <div class="content-base-middle-menu"><?=$html->link('Search Logo','/search',array('title'=>'Search free logo download'))?></div>
        </div>
        <br />
        <div class="content-base-title">
            <h1>Freelogo.web.id links</h1>
        </div>
         <div class="content-base-middle-desciption">
            <div class="content-base-middle-menu"><?=$html->link('Home design & improvement','http://re.web.id',array('title'=>'Home design & home improvement'))?></div>
            <div class="content-base-middle-menu"><?=$html->link('Indonesian Gallery Design','http://ruangmode.com',array('title'=>'Indonesian Gallery Design'))?></div>
            <div class="content-base-middle-menu"><?=$html->link('CakePHP Framework','http://cakephp.org',array('title'=>'CakePHP Framework'))?></div>
        </div>
    </div>
    <div id="content-base-right">
        <div class="content-base-title">
                <h1>Want hire or contact us?</h1>
        </div>
         <div class="content-base-middle-desciption">
            <?=$form->create('Contact',array('action'=>'add'))?>
            <?=$form->textarea('Contact.description',array('label'=>false,'div'=>false,'cols'=>'30','rows'=>'8'))?>
            <?=$form->end('submit')?>
            <div id="emailForm" style="display:none;">
                <h1>Your contact please</h1>
                <?=$form->create('Email',array('action'=>'add'))?>
                <?=$form->input('Email.name',array('label'=>'Name *','div'=>'text','size'=>'30'))?>
                <?=$form->input('Email.email',array('label'=>'Email *','div'=>'text','size'=>'30'))?>
                <?=$form->input('Email.website',array('label'=>'Website (optional)','div'=>'text','size'=>'30'))?>
                <?=$form->end('submit')?>
            </div>
            <div id="contactError" class="error"></div>
        </div>
        <br />
        <div class="content-base-title">
                <h1>Follow FreeLogo twitter</h1>
        </div>
         <div class="content-base-middle-desciption">
             <?=$html->image('themes/twitter.png',array('url'=>'#'))?>
        </div>

        <br />
        <div class="content-base-title">
                <h1>RSS / Feed FreeLogo</h1>
        </div>
         <div class="content-base-middle-desciption">
            <?=$html->image('themes/rss.png',array('url'=>'/freelogo.rss'))?>
        </div>
    </div>
    <div class="clear"></div>
</div>